using Digitalmes.Application.Mes.Equipments.Inspections.Queries;

namespace Digitalmes.WebApi.Endpoints.Mes.Equipments;

/// <summary>
/// 点检记录关联数据终结点。
/// </summary>
public sealed class InspectionDataEndpoint : EndpointGroupBase
{
    public override void Map(WebApplication app)
    {
        app.MapGroup(this, "mes/equipment/inspection", "data")
            .RequireAuthorization()
            .MapGet(GetInspectionDataListAsync, "list");
    }

    [EndpointDescription("查询点检数据")]
    public async Task<IApiResult> GetInspectionDataListAsync(ISender sender, [AsParameters] GetInspectionDataListQuery query)
    {
        var result = await sender.Send(query);
        return result.ToApiResult();
    }
}
